package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsOrderGoodsMapper;
import com.qf.pojo.DtsOrderGoods;
import com.qf.service.OrderGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

@Service
public class OrderGoodsServiceImpl implements OrderGoodsService {

    @Autowired
    private DtsOrderGoodsMapper orderGoodsMapper;

    @Override
    public List<DtsOrderGoods> findByOrderId(Integer orderId) {
        QueryWrapper<DtsOrderGoods> queryWrapper = new QueryWrapper<>();
        if (!StringUtils.isEmpty(orderId)){
            queryWrapper.eq("order_id", orderId);
        }
        queryWrapper.eq("deleted", 0);
        List<DtsOrderGoods> orderGoodsList = orderGoodsMapper.selectList(queryWrapper);
        return orderGoodsList;
    }
}
